<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<{include file='backend/lib/meta.html'}>
<link rel="stylesheet" type="text/css" href="public/theme/backend/css/verydows.css" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/css/main.css" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/css/datetimepicker.css"/>
<script type="text/javascript" src="public/script/jquery.js"></script>
<script type="text/javascript" src="public/theme/backend/js/verydows.js"></script>
<script type="text/javascript" src="public/theme/backend/js/list.js"></script>
<script type="text/javascript">
$(function(){
  searchRes(1);
  
  $('#start_date').datetimepicker ({
    format:'Y-m-d',
    formatDate: 'Y-m-d',
    allowBlank:true,
    onShow:function(ct){
      this.setOptions({maxDate:$('#end_date').val()? $('#end_date').val():false})
    }, timepicker:false
  });
  $('#end_date').datetimepicker ({
    format:'Y-m-d',
    formatDate: 'Y-m-d',
    allowBlank:true,
    onShow:function(ct){
      this.setOptions({minDate:$('#start_date').val()? $('#start_date').val():false})
    }, timepicker:false
  });

});

function searchRes(page_id){
  var dataset = {
    prize:$('#prize').val(),
    order_id:$('#order_id').val(),
    start_date: $('#start_date').val(),
    end_date: $('#end_date').val(),
    page:page_id,
    pernum: 10,
  };
  
  $.asynList("<{url m=$MOD c='order' a='zun_rake' step='search'}>", dataset, function(data){
    $("#amount").text(data.amount);
    if(data.status == 'success'){
      $('#rows').append(juicer($('#table-tpl').html(), data));
      $('#rows tr').vdsRowHover();
      $('#rows tr:even').addClass('even');
      if(data.paging != null) $('#rows').append(juicer($('#paging-tpl').html(), data));
    }else{
      $('#rows').append("<div class='nors mt5'>未找到相关数据记录...</div>");	
    }     
  });
}

function pageturn(page_id){searchRes(page_id);}

function daochuRes(){
  var start_date = $('#start_date').val();
  var end_date = $('#end_date').val();
  var prize = $("#prize").val();
  var url = "/index.php?m=backend&c=order&a=export_excel_zun_rake&start_date=" + start_date + '&end_date=' + end_date + '&prize=' + prize;
  window.location.href = url;
}
</script>
</head>
<body>
<div class="content">
  <div class="loc"><h2><i class="icon"></i>尊贵返佣列表</h2></div>
  <div class="box">
    <div class="doacts">
      <!--<a class="ae btn" onclick="doslvent('<{url m=$MOD c='order' a='view'}>')"><i class="view"></i><font>查看详细</font></a>
      <a class="ae btn" onclick="doslvent('<{url m=$MOD c='order' a='delete'}>')"><i class="remove"></i><font>删除</font></a>
      <a class="ae btn" href="<{url m=$MOD c='order' a='export_excel_zun_rake'}>"><i class="remove"></i><font>导出</font></a>-->

      <a class="ae btn" href="#" onclick="daochuRes()"><i class="remove"></i><font>导出</font></a>

    </div>
    <div class="stools mt5">
      <select id="prize" class="slt">
        <option value="" selected="selected">奖励</option>
        <option disabled="disabled">-------------------</option>
        <option value="3">直推补贴</option>
        <option value="4">收藏</option>
        <option value="5">产品返利</option>
      </select>
      <input value="" class="date w100 txt" id="start_date" type="text" placeholder="开始日期" />
      <input value="" class="date w100 txt" id="end_date" type="text" placeholder="截止日期" />
      <!--<input type="text" class="w300 txt" id="order_id" placeholder="输入订单号" />-->
      <button type="button" class="sbtn btn" onclick="searchRes(1)">搜 索</button>
    </div>
    <div class="module mt5" id="rows"></div>
  </div>
</div>
<script type="text/template" id="table-tpl">
<form method="post" id="mulentform">
  <table class="datalist">
    <tr>
      <th width="60" colspan="2">编号</th>
      <th width="150">用户</th>
      <th width="100">补贴</th>
      <th width="130">补贴金额 (元)</th>
      <th class="ta-l">类别</th>
      <th width="130">获得时间</th>
    </tr>
    {@each list as v}
    <tr>
      <td width="20"><input name="id[]" type="checkbox" value="${v.order_id}" /></td>
      <td width="40">${v.id}</td>
      <td><a class="blue">${v.username}</td>
      <td>$${v.prize}</td>
      <td><b class="red">${v.balance}</b></td>
      <td class="ta-l">
        ${v.type}
      </td>
      <td>${v.dateline}</td>
    </tr>
    {@/each}
  </table>
</form>
</script>
总金额：<b id="amount"><{$amount}></b>元
<{include file='backend/lib/paging.html'}>
<script type="text/javascript" src="public/script/juicer.js"></script>
<script type="text/javascript" src="public/theme/backend/js/datetimepicker.js"></script>
</body>
</html>